﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterALSafa.Master" AutoEventWireup="true"
    CodeBehind="CourseSchedule.aspx.cs" Inherits="School.Pages.Teaching.CourseSchedule" EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>
        جدول الحصص</h1>
    <table width="100%">
        <tr>
            <td width="20%">
                المجمع
            </td>
            <td>
                <asp:DropDownList ID="LstCampuses" runat="server" OnSelectedIndexChanged="LstCampuses_SelectedIndexChanged"
                    AutoPostBack="True">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                الشهادة
            </td>
            <td>
                <asp:DropDownList ID="LstCertificates" runat="server" AutoPostBack="True" OnSelectedIndexChanged="LstCertificates_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                المرحلة
            </td>
            <td>
                <asp:DropDownList ID="LstStages" runat="server" AutoPostBack="True" OnSelectedIndexChanged="LstStages_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                الصف
            </td>
            <td>
                <asp:DropDownList ID="LstGrades" runat="server" AutoPostBack="True" OnSelectedIndexChanged="LstGrades_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                الفصل
            </td>
            <td>
                <asp:DropDownList ID="lstClasses" runat="server" AutoPostBack="True" OnSelectedIndexChanged="lstClasses_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <div runat="server" id="CoursesContainer" clientidmode="Static">
    </div>
    <div class="subject_teacher_list">
        <h2>
            اختر المادة</h2>
        <table>
            <tr>
                <td>
                    المادة
                </td>
                <td>
                    <asp:DropDownList ClientIDMode="Static" ID="DdlSubject" runat="server" >
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    المدرس
                </td>
                <td>
                    <asp:DropDownList ClientIDMode="Static" ID="DdlTeacher" runat="server" >
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <input class="set_subject" type="button" value="تعديل الحصة" />
    </div>
    <script type="text/javascript">
        $().ready(function () {
            var course_block;
            $('.edit_course').live("click", function () {
                course_block = $(this);
                $('.subject_teacher_list').show();
            });

            $('#DdlSubject').change(function () {
                $.getJSON('ajaxGetCourseTeacher.aspx?subject_id=' + $(this).val(), function (data) {
                    $("#DdlTeacher").html("");
                    $.each(data, function (index) {
                        $("#DdlTeacher").append("<option value='" + data[index].id + "'>" + data[index].name + "</option>");
                    })
                });
            });

            $('.set_subject').click(function () {
                course_block.parent().find('input').val($("#DdlTeacher").val());
                course_block.parent().find('.course').html($("#DdlSubject option[value='" + $("#DdlSubject").val() + "']").text());
                $('.subject_teacher_list').hide();
            });
        });
    </script>
    <asp:Button ID="Button1" runat="server" Text="حفظ" onclick="Button1_Click" />
</asp:Content>
